<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>帮帮网</title>
<link href="default.css" media="screen" rel="stylesheet" />
<!-- 引入 jQuery --> 
<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>  -->
<script src="JS/jquery-1.3.2.min.js" type="text/javascript"></script>
<!--<script type="text/javascript" src="JS/prototype.js"></script>-->
<script type="text/javascript" src="JS/httpRequest.js"></script>
<script type="text/javascript" src="JS/cookie.js"></script>
<script type="text/javascript">  
//等待dom元素加载完毕.  
$(document).ready(function(){ 
	
	$("#selector ul li").click(function(){
		if($(this).hasClass("selector_on"))
		{
			
		}
		else
		{
			var sel_on = $("#selector .selector_on");
			sel_on.addClass("selector_off");
			sel_on.removeClass("selector_on");
			$(this).addClass("selector_on");
			$(this).removeClass("selector_off");
			//todo 刷新任务推送内容
		}
	});

	$("#left_bar ul li").hover(
		function(){
			$(this).addClass("selector_on");
			$(this).removeClass("selector_off");
			//todo 抽出关注度最高的十个人 悬浮于右侧
		},
		function(){
			$(this).addClass("selector_off");
			$(this).removeClass("selector_on");
			//todo 取消显示右侧的人名
		}
	);

});  


//获取个人信息模块
function GetUserInfo()
{
    var showcookies=document.getElementById('showcookies');
	username=getCookie('username');
	userID = getCookie('userID');
	timenow = new Date();
	//alert('userID');
	//alert(userID);
	if (username!=null && username!="")
	{
		//alert('Welcome again '+username+'!')
		
	}
	else
	{
		alert('请先登录');
		return false;
	}

	//根据cookie提供的用户名 username 去取得用户的信息
	var url="user/user.php?action=GetUserInfo";
	var para="username="+username;
	para+="&userID="+userID;
	var resp=SendPostRequest(url,para);
	showcookies.innerHTML=username+resp;
	//alert(resp);
	if(resp!=null)
	{
		//var UserInfoListDiv=document.getElementById('UserInfoListDiv');
		var UserInfoListDiv=document.getElementById('user_info');
		//刷新前 先清空子节点
		var childs = UserInfoListDiv.childNodes;
		for(var i=childs.length-1; i>=0; i--){
			UserInfoListDiv.removeChild(childs[i]);
		}

		var userinfo=eval("("+resp+")");
		for(var i=0;i<userinfo.length;i++)
		{
			var userinfoDiv=document.createElement('div');
			//userinfoDiv.style.width="300px";
			//userinfoDiv.style.margin="20px";
			//userinfoDiv.style.border="1px solid #ccc";
			
			//姓名
			var nameDiv=document.createElement('div');
			nameDiv.style.padding="10px";
			nameDiv.innerHTML="<font style='font:14px bold'>"+userinfo[i].name+"</font>";	
	
			//头像 todo
			var avatarDiv=document.createElement('div');
			avatarDiv.style.padding="10px";
			//avatarDiv.innerHTML="<font style='font:14px bold'>头像 <a href='imgpick/imgpick.htm' > 上传头像 </a></font>";	
			//avatarDiv.innerHTML="<img id='av' src='imgpick/uploads/"+userID+".png'> onerror=' av.src='imgpick/uploads/0.jpg' ' ";	
			//去掉后缀名 兼容各种图片
			avatarDiv.innerHTML="<div id='av'><a href='imgpick/imgPick.htm'><img src='imgpick/uploads/"+userID+"?"+timenow+"' onerror='nopic()' alt='您的头像，点击修改' /></a></div>";	
			//<img   src= "要显示的图片路径 "   id=kk   onerror= "kk.src= '出错时显示图片的地址 ' ">
			//相册
			var albumDiv=document.createElement('div');
			albumDiv.style.padding="10px";
			albumDiv.innerHTML="<font style='font:14px bold'>相册 交由周青移植整合   "+userinfo[i]. album+"</font>";	

			//id
			var idDiv=document.createElement('div');
			idDiv.style.padding="10px";
			idDiv.innerHTML="<font style='font:14px bold'>"+userinfo[i].id+"</font>";	

			//qq
			var qqDiv=document.createElement('div');
			qqDiv.style.padding="10px";
			qqDiv.innerHTML="<font style='font:14px bold'>QQ：   "+userinfo[i].qq+"</font>";	

			//cellphone
			var cellDiv=document.createElement('div');
			cellDiv.style.padding="10px";
			cellDiv.innerHTML="<font style='font:14px bold'>手机号码：   "+userinfo[i].cellphone+"</font>";

			//sex
			var sexDiv=document.createElement('div');
			sexDiv.style.padding="10px";
			sexDiv.innerHTML="<font style='font:14px bold'>性别：   "+userinfo[i].sex+"</font>";
			
			//emot
			var emotDiv=document.createElement('div');
			emotDiv.style.padding="10px";
			emotDiv.innerHTML="<font style='font:14px bold'>感情状态：   "+userinfo[i].emot+"</font>";

			//出生年月日
			var birthDiv=document.createElement('div');
			birthDiv.style.padding="10px";
			birthDiv.innerHTML="<font style='font:14px bold'>出生年月日：   "+userinfo[i].year+"年"+userinfo[i].month
			+"月"+userinfo[i].day+"日"+"</font>";		

			//经验值 活跃度
			var expDiv=document.createElement('div');
			expDiv.style.padding="10px";
			expDiv.innerHTML="<font style='font:14px bold'>活跃度     "+userinfo[i].exp+"</font>";	
			
			//好评度
			var goodCommentDiv=document.createElement('div');
			goodCommentDiv.style.padding="10px";
			goodCommentDiv.innerHTML="<font style='font:14px bold'>好评度      "+userinfo[i].goodcomment+"</font>";	

			//差评度
			var badCommentDiv=document.createElement('div');
			badCommentDiv.style.padding="10px";
			badCommentDiv.innerHTML="<font style='font:14px bold'>差评度       "+userinfo[i].badcomment+"</font>";	

			//历史记录
			var historyDiv=document.createElement('div');
			historyDiv.style.padding="10px";
			historyDiv.innerHTML="<font style='font:14px bold'>历史记录 等待系统完成后再完善   "+userinfo[i].history+"</font>";	

			userinfoDiv.appendChild(avatarDiv);//头像 todo
			userinfoDiv.appendChild(nameDiv);//姓名
//			userinfoDiv.appendChild(albumDiv);//相册貌似木有整合 ~~~~(>_<)~~~~ 
			userinfoDiv.appendChild(qqDiv);
			userinfoDiv.appendChild(cellDiv);
			userinfoDiv.appendChild(sexDiv);
			userinfoDiv.appendChild(emotDiv);
			userinfoDiv.appendChild(birthDiv);
			//userinfoDiv.appendChild(idDiv);
			userinfoDiv.appendChild(expDiv);
			userinfoDiv.appendChild(goodCommentDiv);
			userinfoDiv.appendChild(badCommentDiv);
//			userinfoDiv.appendChild(historyDiv);		//待完善 ~~~~(>_<)~~~~ 	

			UserInfoListDiv.appendChild(userinfoDiv);
		}
	}
	else
	{
		alert('resp is NULL');
	}
	//showFriends();//移到新页面中实现
	//showFollowers();
	//showOtherUsers();
	getiFocusCateList();//获取个人关注内容list
}

//获取个人关注内容list
function getiFocusCateList()
{
	var iFocusCateList=document.getElementById('iFocusCateList');	
		//刷新前 先清空子节点
	var childs = iFocusCateList.childNodes;
	for(var i=childs.length-1; i>=0; i--){
		iFocusCateList.removeChild(childs[i]);
	}

	if(userID==""||userID==null)
	{
		alert("请先登录");
	}
	else
	{
		var url="user/user.php?action=iFocusCate";
		var para="userID="+userID;
		var resp=SendPostRequest(url,para);
		//alert(resp);
	}
	if(resp!=null || resp != 'false')
	{
		eval("fList="+resp);
		for(var i=0;i<fList.length;i++)
		{
			var fcate=document.createElement('div');
			fcate.style.padding="10px";
			fcate.innerHTML="<li><font style='14px bold'>"+fList[i].name+"</font></li>";
			iFocusCateList.appendChild(fcate);		
		}
		if(i==0)
		{
			var fcate=document.createElement('div');
			fcate.style.padding="10px";
			fcate.innerHTML="<li><a href='index.html'><font style='16px bold'>"+"赶紧关注一个分类吧"+"</font></a></li>"; //主页东西太多啦，是不是要另做个所有分类的页面？ by ggbondg
			iFocusCateList.appendChild(fcate);		
		}
	}

}

function showAllReqList()
{
	$("#helps").show();
	$("#addhelp").hide();

	//alert('showAllReqList');//alert(allReqListHasShown);
	var allreqListDiv=document.getElementById('helps');
		//刷新前 先清空子节点
		var childs = allreqListDiv.childNodes;
		for(var i=childs.length-1; i>=0; i--){
			allreqListDiv.removeChild(childs[i]);
		}


		var url="help/help.php?action=allReqList";
		var para=null;
		var resp=SendPostRequest(url,para);
		//alert(resp);
		//resp="("+resp+")";
		if(resp!=null || resp != 'false')
		{

			eval("allreqList="+resp);
			//alert(allreqList);//alert('allreqList.length=  '); //alert(allreqList.length);
			for(var i=0;i<allreqList.length;i++)
			{
				//
				var admincheck;
				if(username!=allreqList[i].requesterName)
					admincheck = false;
				else
					admincheck = true;
				
				//显示需求
				//var reqDiv=document.createElement('div');
				//reqDiv.style.width="300px";
				//reqDiv.style.margin="20px";
				//reqDiv.style.border="1px solid #ccc";
				var reqDiv=document.createElement("div");
				reqDiv.setAttribute("class","help");	
			
				//title 标题
				var titleDiv=document.createElement('div');
				titleDiv.style.padding="10px";
				titleDiv.innerHTML="<font style='14px bold'><a href='help/help.htm?"+allreqList[i].id+"' target='_blank'>"+allreqList[i].title+"</a></font>";
				reqDiv.appendChild(titleDiv);

				//money 赏金
				var moneyDiv=document.createElement('div');
				moneyDiv.style.padding="10px";
				moneyDiv.innerHTML="<font style='14px bold'>目标赏金："+allreqList[i].money+"</font>";
				reqDiv.appendChild(moneyDiv);

				//发布人
				var requesterDiv=document.createElement('div');
				requesterDiv.style.padding="10px";
				if(admincheck==true)//链接到主页
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+allreqList[i].userID+"'/>"+allreqList[i].requesterName+"</a></font>";
				else				//链接到其他人的个人页面
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='hisSpace.htm?"+allreqList[i].userID+"'><img width=50 height=50 src='imgpick/uploads/"+allreqList[i].userID+"'/>"+allreqList[i].requesterName+"</a></font>";			
				reqDiv.appendChild(requesterDiv);
				//承接人
				var chooseDiv=document.createElement('div');
				chooseDiv.style.padding="10px";
				if(allreqList[i].chooseID==0)
					chooseDiv.innerHTML="<font style='14px bold'>暂时无人承接 <a href='help/help.htm?"+allreqList[i].id+"' target='_blank'> 请申请 </font><img width=50 height=50 src='imgpick/uploads/logo.jpg'/> </a>";
				else if(userID==allreqList[i].chooseID)//链接到主页
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+allreqList[i].chooseID+"'/>"+allreqList[i].chooseName+"</a></font>";
				else				//链接到其他人的个人页面
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='hisSpace.htm?"+allreqList[i].chooseID+"'><img width=50 height=50 src='imgpick/uploads/"+allreqList[i].chooseID+"'/>"+allreqList[i].chooseName+"</a></font>";			
				reqDiv.appendChild(chooseDiv);
				//分类
				var  cateDiv=document.createElement('div');
				cateDiv.style.padding="10px";
				cateDiv.innerHTML="<font style='14px bold'>类别：		"+allreqList[i].cate+"</font>";				
				reqDiv.appendChild(cateDiv);
				//简介
				var  descriptionDiv=document.createElement('div');
				descriptionDiv.style.padding="10px";
				descriptionDiv.innerHTML="<font style='14px bold'>简介：        "+allreqList[i].description+"</font>";				
				reqDiv.appendChild(descriptionDiv);
				//状态
				var  statusDiv=document.createElement('div');
				statusDiv.style.padding="10px";
				statusDiv.innerHTML="<font style='14px bold'>状态：       "+allreqList[i].statusstr+"</font>";				
				reqDiv.appendChild(statusDiv);
				//详情
				var  detailDiv=document.createElement('div');
				detailDiv.style.padding="10px";
				detailDiv.innerHTML="<font style='14px bold'>详情：       "+allreqList[i].detail+"</font>";				
				reqDiv.appendChild(detailDiv);
				//对发布人评分
				var  ScoreReqDiv=document.createElement('div');
				ScoreReqDiv.style.padding="10px";
				if(allreqList[i].flagScoreReq!=0)	
					ScoreReqDiv.innerHTML="<font style='14px bold'>发布人得分：       "+allreqList[i].ScoreReq+"</font>";				
				else
					ScoreReqDiv.innerHTML="<font style='14px bold'>承接人还没有对发布人打分</font>";				
				reqDiv.appendChild(ScoreReqDiv);
				//对承接人评分
				var  ScoreChooseDiv=document.createElement('div');
				ScoreChooseDiv.style.padding="10px";
				if(allreqList[i].flagScoreChoose!=0)	
					ScoreChooseDiv.innerHTML="<font style='14px bold'>承接人得分：       "+allreqList[i].ScoreChoose+"</font>";				
				else
					ScoreChooseDiv.innerHTML="<font style='14px bold'>发布人还没有对承接人打分</font>";				
				reqDiv.appendChild(ScoreChooseDiv);

				allreqListDiv.appendChild(reqDiv);				
			}	
		}

}



function showiReqList()
{
	$("#helps").show();
	$("#addhelp").hide();

	var ireqListDiv=document.getElementById('helps');
		//刷新前 先清空子节点
		var childs = ireqListDiv.childNodes;
		for(var i=childs.length-1; i>=0; i--){
			ireqListDiv.removeChild(childs[i]);
		}

		var username=getCookie("username");
		if(username==""||username==null)
		{
			alert("请先登录");
		}
		else
		{
			var url="help/help.php?action=iReqList";
			var para="&username="+username;
			var resp=SendPostRequest(url,para);
			//alert(resp);
		}
		if(resp!=null || resp != 'false')
		{
					
			ireqListDiv.style.display="block";
			eval("ireqList="+resp);	//比起var actlist， actlist变成了一个全局的变量 可以动态插入
				//actList获得 alert(ireqList);  //alert('ireqList.length=  '); //alert(ireqList.length);
			for(var i=0;i<ireqList.length;i++)
			{
				var admincheck;
				if(username!=ireqList[i].requesterName)
					admincheck = false;
				else
					admincheck = true;

				var reqDiv=document.createElement("div");
				reqDiv.setAttribute("class","help");	
						

				var id=ireqList[i].id;
				//alert(id);

				var titleDiv=document.createElement('div');
				titleDiv.style.padding="10px";
				titleDiv.innerHTML="<font style='14px bold'><a href='help/help.htm?"+id+"' target='_blank'>"+ireqList[i].title+"</a></font>";				
				reqDiv.appendChild(titleDiv);
	
				//money 赏金
				var moneyDiv=document.createElement('div');
				moneyDiv.style.padding="10px";
				moneyDiv.innerHTML="<font style='14px bold'>目标赏金："+ireqList[i].money+"</font>";
				reqDiv.appendChild(moneyDiv);
				
				//发布人
				var requesterDiv=document.createElement('div');
				requesterDiv.style.padding="10px";
				if(admincheck==true)//链接到主页
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+ireqList[i].userID+"'/>"+ireqList[i].requesterName+"</a></font>";
				else				//链接到其他人的个人页面
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='hisSpace.htm?"+ireqList[i].userID+"'><img width=50 height=50 src='imgpick/uploads/"+ireqList[i].userID+"'/>"+ireqList[i].requesterName+"</a></font>";			
				reqDiv.appendChild(requesterDiv);



				//承接人
				var chooseDiv=document.createElement('div');
				chooseDiv.style.padding="10px";
				if(ireqList[i].chooseID==0)
					chooseDiv.innerHTML="<font style='14px bold'>暂时无人承接 </font><img width=50 height=50 src='imgpick/uploads/logo.jpg'/>";
				else if(userID==ireqList[i].chooseID)//链接到主页
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+ireqList[i].chooseID+"'/>"+ireqList[i].chooseName+"</a></font>";
				else				//链接到其他人的个人页面
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='hisSpace.htm?"+ireqList[i].chooseID+"'><img width=50 height=50 src='imgpick/uploads/"+ireqList[i].chooseID+"'/>"+ireqList[i].chooseName+"</a></font>";			
				reqDiv.appendChild(chooseDiv);

				var  cateDiv=document.createElement('div');
				cateDiv.style.padding="10px";
				cateDiv.innerHTML="<font style='14px bold'>类别：		"+ireqList[i].cate+"</font>";				
				reqDiv.appendChild(cateDiv);

				var  descriptionDiv=document.createElement('div');
				descriptionDiv.style.padding="10px";
				descriptionDiv.innerHTML="<font style='14px bold'>简介：        "+ireqList[i].description+"</font>";				
				reqDiv.appendChild(descriptionDiv);

				var  detailDiv=document.createElement('div');
				detailDiv.style.padding="10px";
				detailDiv.innerHTML="<font style='14px bold'>详情：       "+ireqList[i].detail+"</font>";				
				reqDiv.appendChild(detailDiv);
				//状态
				var  statusDiv=document.createElement('div');
				statusDiv.style.padding="10px";
				statusDiv.innerHTML="<font style='14px bold'>状态：       "+ireqList[i].statusstr+"</font>";				
				reqDiv.appendChild(statusDiv);
				//对发布人评分
				var  ScoreReqDiv=document.createElement('div');
				ScoreReqDiv.style.padding="10px";
				if(ireqList[i].flagScoreReq!=0)	
					ScoreReqDiv.innerHTML="<font style='14px bold'>发布人得分：       "+ireqList[i].ScoreReq+"</font>";				
				else
					ScoreReqDiv.innerHTML="<font style='14px bold'>承接人还没有对发布人打分</font>";				
				reqDiv.appendChild(ScoreReqDiv);
				//对承接人评分
				var  ScoreChooseDiv=document.createElement('div');
				ScoreChooseDiv.style.padding="10px";
				if(ireqList[i].flagScoreChoose!=0)	
					ScoreChooseDiv.innerHTML="<font style='14px bold'>承接人得分：       "+ireqList[i].ScoreChoose+"</font>";				
				else
					ScoreChooseDiv.innerHTML="<font style='14px bold'>发布人还没有对承接人打分</font>";				
				reqDiv.appendChild(ScoreChooseDiv);

				ireqListDiv.appendChild(reqDiv);				
			}	
		}


}


function showiApplyList()
{
	$("#helps").show();
	$("#addhelp").hide();

	var helpListDiv=document.getElementById('helps');
		//刷新前 先清空子节点
		var childs = helpListDiv.childNodes;
		for(var i=childs.length-1; i>=0; i--){
			helpListDiv.removeChild(childs[i]);
		}

		var userID=getCookie("userID");
		if(userID==""||userID==null)
		{
			alert("请先登录");
		}
		else
		{
			var url="help/help.php?action=iApplyList";
			var para="&userID="+userID;
			var resp=SendPostRequest(url,para);
			//alert(resp);
		}
		if(resp!=null || resp != 'false')
		{
			//alert('ca0');
			helpListDiv.style.display="block";
			eval("helpList="+resp);	//比起var actlist， actlist变成了一个全局的变量 可以动态插入
			for(var i=0;i<helpList.length;i++)
			{
				var admincheck;
				if(username!=helpList[i].requesterName)
					admincheck = false;
				else
					admincheck = true;

				var reqDiv=document.createElement("div");
				reqDiv.setAttribute("class","help");	
						

				var id=helpList[i].id;
				//alert(id);

				var titleDiv=document.createElement('div');
				titleDiv.style.padding="10px";
				titleDiv.innerHTML="<font style='14px bold'><a href='help/help.htm?"+id+"' target='_blank'>"+helpList[i].title+"</a></font>";				
				reqDiv.appendChild(titleDiv);

				//money 赏金
				var moneyDiv=document.createElement('div');
				moneyDiv.style.padding="10px";
				moneyDiv.innerHTML="<font style='14px bold'>目标赏金："+helpList[i].money+"</font>";
				reqDiv.appendChild(moneyDiv);

				//发布人
				var requesterDiv=document.createElement('div');
				requesterDiv.style.padding="10px";
				if(admincheck==true)//链接到主页
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].userID+"'/>"+helpList[i].requesterName+"</a></font>";
				else				//链接到其他人的个人页面
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='hisSpace.htm?"+helpList[i].userID+"'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].userID+"'/>"+helpList[i].requesterName+"</a></font>";			
				reqDiv.appendChild(requesterDiv);
				
				//承接人
				var chooseDiv=document.createElement('div');
				chooseDiv.style.padding="10px";
				if(helpList[i].chooseID==0)
					chooseDiv.innerHTML="<font style='14px bold'>主人未将任务指定给谁 请等待主人做决定</font>";
				else if(userID==helpList[i].chooseID)//链接到主页
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].chooseID+"'/>"+helpList[i].chooseName+"</a></font>";
				else				//链接到其他人的个人页面
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='hisSpace.htm?"+helpList[i].chooseID+"'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].chooseID+"'/>"+helpList[i].chooseName+"</a></font>";			
				reqDiv.appendChild(chooseDiv);

				var  cateDiv=document.createElement('div');
				cateDiv.style.padding="10px";
				cateDiv.innerHTML="<font style='14px bold'>类别：		"+helpList[i].cate+"</font>";				
				reqDiv.appendChild(cateDiv);

				var  descriptionDiv=document.createElement('div');
				descriptionDiv.style.padding="10px";
				descriptionDiv.innerHTML="<font style='14px bold'>简介：        "+helpList[i].description+"</font>";				
				reqDiv.appendChild(descriptionDiv);

				var  detailDiv=document.createElement('div');
				detailDiv.style.padding="10px";
				detailDiv.innerHTML="<font style='14px bold'>详情：       "+helpList[i].detail+"</font>";				
				reqDiv.appendChild(detailDiv);
				//状态
				var  statusDiv=document.createElement('div');
				statusDiv.style.padding="10px";
				statusDiv.innerHTML="<font style='14px bold'>状态：       "+helpList[i].statusstr+"</font>";				
				reqDiv.appendChild(statusDiv);
				//对发布人评分
				var  ScoreReqDiv=document.createElement('div');
				ScoreReqDiv.style.padding="10px";
				if(helpList[i].flagScoreReq!=0)	
					ScoreReqDiv.innerHTML="<font style='14px bold'>发布人得分：       "+helpList[i].ScoreReq+"</font>";				
				else
					ScoreReqDiv.innerHTML="<font style='14px bold'>承接人还没有对发布人打分</font>";				
				reqDiv.appendChild(ScoreReqDiv);
				//对承接人评分
				var  ScoreChooseDiv=document.createElement('div');
				ScoreChooseDiv.style.padding="10px";
				if(helpList[i].flagScoreChoose!=0)	
					ScoreChooseDiv.innerHTML="<font style='14px bold'>承接人得分：       "+helpList[i].ScoreChoose+"</font>";				
				else
					ScoreChooseDiv.innerHTML="<font style='14px bold'>发布人还没有对承接人打分</font>";				
				reqDiv.appendChild(ScoreChooseDiv);

				helpListDiv.appendChild(reqDiv);				
			}	
		}


}

function showiChooseList()
{
	$("#helps").show();
	$("#addhelp").hide();

	var helpListDiv=document.getElementById('helps');
		//刷新前 先清空子节点
		var childs = helpListDiv.childNodes;
		for(var i=childs.length-1; i>=0; i--){
			helpListDiv.removeChild(childs[i]);
		}

		var userID=getCookie("userID");
		if(userID==""||userID==null)
		{
			alert("请先登录");
		}
		else
		{
			var url="help/help.php?action=iChooseList";
			var para="&userID="+userID;
			var resp=SendPostRequest(url,para);
			//alert(resp);
		}
		if(resp!=null || resp != 'false')
		{
			//alert('ca0');
			helpListDiv.style.display="block";
			eval("helpList="+resp);	//比起var actlist， actlist变成了一个全局的变量 可以动态插入
			for(var i=0;i<helpList.length;i++)
			{
				var admincheck;
				if(username!=helpList[i].requesterName)
					admincheck = false;
				else
					admincheck = true;

				var reqDiv=document.createElement("div");
				reqDiv.setAttribute("class","help");	
						

				var id=helpList[i].id;
				//alert(id);

				var titleDiv=document.createElement('div');
				titleDiv.style.padding="10px";
				titleDiv.innerHTML="<font style='14px bold'><a href='help/help.htm?"+id+"' target='_blank'>"+helpList[i].title+"</a></font>";				
				reqDiv.appendChild(titleDiv);

				//money 赏金
				var moneyDiv=document.createElement('div');
				moneyDiv.style.padding="10px";
				moneyDiv.innerHTML="<font style='14px bold'>目标赏金："+helpList[i].money+"</font>";
				reqDiv.appendChild(moneyDiv);

				//发布人
				var requesterDiv=document.createElement('div');
				requesterDiv.style.padding="10px";
				if(admincheck==true)//链接到主页
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].userID+"'/>"+helpList[i].requesterName+"</a></font>";
				else				//链接到其他人的个人页面
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='hisSpace.htm?"+helpList[i].userID+"'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].userID+"'/>"+helpList[i].requesterName+"</a></font>";			
				reqDiv.appendChild(requesterDiv);
				
				//承接人
				var chooseDiv=document.createElement('div');
				chooseDiv.style.padding="10px";
				if(helpList[i].chooseID==0)
					chooseDiv.innerHTML="<font style='14px bold'>暂时无人承接 请申请</font>";
				else if(userID==helpList[i].chooseID)//链接到主页
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].chooseID+"'/>"+helpList[i].chooseName+"</a></font>";
				else				//链接到其他人的个人页面
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='hisSpace.htm?"+helpList[i].chooseID+"'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].chooseID+"'/>"+helpList[i].chooseName+"</a></font>";			
				reqDiv.appendChild(chooseDiv);

				var  cateDiv=document.createElement('div');
				cateDiv.style.padding="10px";
				cateDiv.innerHTML="<font style='14px bold'>类别：		"+helpList[i].cate+"</font>";				
				reqDiv.appendChild(cateDiv);

				var  descriptionDiv=document.createElement('div');
				descriptionDiv.style.padding="10px";
				descriptionDiv.innerHTML="<font style='14px bold'>简介：        "+helpList[i].description+"</font>";				
				reqDiv.appendChild(descriptionDiv);

				var  detailDiv=document.createElement('div');
				detailDiv.style.padding="10px";
				detailDiv.innerHTML="<font style='14px bold'>详情：       "+helpList[i].detail+"</font>";				
				reqDiv.appendChild(detailDiv);
				//状态
				var  statusDiv=document.createElement('div');
				statusDiv.style.padding="10px";
				statusDiv.innerHTML="<font style='14px bold'>状态：       "+helpList[i].statusstr+"</font>";				
				reqDiv.appendChild(statusDiv);
				//对发布人评分
				var  ScoreReqDiv=document.createElement('div');
				ScoreReqDiv.style.padding="10px";
				if(helpList[i].flagScoreReq!=0)	
					ScoreReqDiv.innerHTML="<font style='14px bold'>发布人得分：       "+helpList[i].ScoreReq+"</font>";				
				else
					ScoreReqDiv.innerHTML="<font style='14px bold'>承接人还没有对发布人打分</font>";				
				reqDiv.appendChild(ScoreReqDiv);
				//对承接人评分
				var  ScoreChooseDiv=document.createElement('div');
				ScoreChooseDiv.style.padding="10px";
				if(helpList[i].flagScoreChoose!=0)	
					ScoreChooseDiv.innerHTML="<font style='14px bold'>承接人得分：       "+helpList[i].ScoreChoose+"</font>";				
				else
					ScoreChooseDiv.innerHTML="<font style='14px bold'>发布人还没有对承接人打分</font>";				
				reqDiv.appendChild(ScoreChooseDiv);

				helpListDiv.appendChild(reqDiv);				
			}	
		}
}

//朋友的需求
function showfriendReqList()
{
	$("#helps").show();
	$("#addhelp").hide();

	var helpListDiv=document.getElementById('helps');
		//刷新前 先清空子节点
	var childs = helpListDiv.childNodes;
	for(var i=childs.length-1; i>=0; i--){
		helpListDiv.removeChild(childs[i]);
	}

	var userID=getCookie("userID");
	if(userID==""||userID==null)
	{
		alert("请先登录");
	}
	else
	{
		var url="help/help.php?action=friendReqList";
		var para="&userID="+userID;
		var resp=SendPostRequest(url,para);
		//alert(resp);
	}
	if(resp!=null || resp != 'false')
	{
			//alert('ca0');
			helpListDiv.style.display="block";
			eval("helpList="+resp);	//比起var actlist， actlist变成了一个全局的变量 可以动态插入
			for(var i=0;i<helpList.length;i++)
			{
				var admincheck;
				if(username!=helpList[i].requesterName)
					admincheck = false;
				else
					admincheck = true;

				var reqDiv=document.createElement("div");
				reqDiv.setAttribute("class","help");	
						

				var id=helpList[i].id;
				//alert(id);

				var titleDiv=document.createElement('div');
				titleDiv.style.padding="10px";
				titleDiv.innerHTML="<font style='14px bold'><a href='help/help.htm?"+id+"' target='_blank'>"+helpList[i].title+"</a></font>";				
				reqDiv.appendChild(titleDiv);

				//money 赏金
				var moneyDiv=document.createElement('div');
				moneyDiv.style.padding="10px";
				moneyDiv.innerHTML="<font style='14px bold'>目标赏金："+helpList[i].money+"</font>";
				reqDiv.appendChild(moneyDiv);

				//发布人
				var requesterDiv=document.createElement('div');
				requesterDiv.style.padding="10px";
				if(admincheck==true)//链接到主页
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].userID+"'/>"+helpList[i].requesterName+"</a></font>";
				else				//链接到其他人的个人页面
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='hisSpace.htm?"+helpList[i].userID+"'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].userID+"'/>"+helpList[i].requesterName+"</a></font>";			
				reqDiv.appendChild(requesterDiv);
				
				//承接人
				var chooseDiv=document.createElement('div');
				chooseDiv.style.padding="10px";
				if(helpList[i].chooseID==0)
					chooseDiv.innerHTML="<font style='14px bold'>暂时无人承接 请申请</font>";
				else if(userID==helpList[i].chooseID)//链接到主页
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].chooseID+"'/>"+helpList[i].chooseName+"</a></font>";
				else				//链接到其他人的个人页面
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='hisSpace.htm?"+helpList[i].chooseID+"'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].chooseID+"'/>"+helpList[i].chooseName+"</a></font>";			
				reqDiv.appendChild(chooseDiv);

				var  cateDiv=document.createElement('div');
				cateDiv.style.padding="10px";
				cateDiv.innerHTML="<font style='14px bold'>类别：		"+helpList[i].cate+"</font>";				
				reqDiv.appendChild(cateDiv);

				var  descriptionDiv=document.createElement('div');
				descriptionDiv.style.padding="10px";
				descriptionDiv.innerHTML="<font style='14px bold'>简介：        "+helpList[i].description+"</font>";				
				reqDiv.appendChild(descriptionDiv);

				var  detailDiv=document.createElement('div');
				detailDiv.style.padding="10px";
				detailDiv.innerHTML="<font style='14px bold'>详情：       "+helpList[i].detail+"</font>";				
				reqDiv.appendChild(detailDiv);
				//状态
				var  statusDiv=document.createElement('div');
				statusDiv.style.padding="10px";
				statusDiv.innerHTML="<font style='14px bold'>状态：       "+helpList[i].statusstr+"</font>";				
				reqDiv.appendChild(statusDiv);
				//对发布人评分
				var  ScoreReqDiv=document.createElement('div');
				ScoreReqDiv.style.padding="10px";
				if(helpList[i].flagScoreReq!=0)	
					ScoreReqDiv.innerHTML="<font style='14px bold'>发布人得分：       "+helpList[i].ScoreReq+"</font>";				
				else
					ScoreReqDiv.innerHTML="<font style='14px bold'>承接人还没有对发布人打分</font>";				
				reqDiv.appendChild(ScoreReqDiv);
				//对承接人评分
				var  ScoreChooseDiv=document.createElement('div');
				ScoreChooseDiv.style.padding="10px";
				if(helpList[i].flagScoreChoose!=0)	
					ScoreChooseDiv.innerHTML="<font style='14px bold'>承接人得分：       "+helpList[i].ScoreChoose+"</font>";				
				else
					ScoreChooseDiv.innerHTML="<font style='14px bold'>发布人还没有对承接人打分</font>";				
				reqDiv.appendChild(ScoreChooseDiv);

				helpListDiv.appendChild(reqDiv);				
			}	
	}

}

function showiFocusList()
{
	$("#helps").show();
	$("#addhelp").hide();

	var helpListDiv=document.getElementById('helps');
		//刷新前 先清空子节点
		var childs = helpListDiv.childNodes;
		for(var i=childs.length-1; i>=0; i--){
			helpListDiv.removeChild(childs[i]);
		}

		var userID=getCookie("userID");
		if(userID==""||userID==null)
		{
			alert("请先登录");
		}
		else
		{
			var url="help/help.php?action=iFocusList";
			var para="&userID="+userID;
			var resp=SendPostRequest(url,para);
			//alert(resp);
		}
		if(resp!=null || resp != 'false')
		{
			//alert('ca0');
			helpListDiv.style.display="block";
			eval("helpList="+resp);	//比起var actlist， actlist变成了一个全局的变量 可以动态插入
			for(var i=0;i<helpList.length;i++)
			{
				var admincheck;
				if(username!=helpList[i].requesterName)
					admincheck = false;
				else
					admincheck = true;

				var reqDiv=document.createElement("div");
				reqDiv.setAttribute("class","help");	
						

				var id=helpList[i].id;
				//alert(id);

				var titleDiv=document.createElement('div');
				titleDiv.style.padding="10px";
				titleDiv.innerHTML="<font style='14px bold'><a href='help/help.htm?"+id+"' target='_blank'>"+helpList[i].title+"</a></font>";				
				reqDiv.appendChild(titleDiv);

				//money 赏金
				var moneyDiv=document.createElement('div');
				moneyDiv.style.padding="10px";
				moneyDiv.innerHTML="<font style='14px bold'>目标赏金："+helpList[i].money+"</font>";
				reqDiv.appendChild(moneyDiv);

				//发布人
				var requesterDiv=document.createElement('div');
				requesterDiv.style.padding="10px";
				if(admincheck==true)//链接到主页
					requesterDiv.innerHTML="<font style='14px bold'>发i布者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].userID+"'/>"+helpList[i].requesterName+"</a></font>";
				else				//链接到其他人的个人页面
					requesterDiv.innerHTML="<font style='14px bold'>发b布者 <a href='hisSpace.htm?"+helpList[i].userID+"'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].userID+"'/>"+helpList[i].requesterName+"</a></font>";			
				reqDiv.appendChild(requesterDiv);
				
				//承接人
				var chooseDiv=document.createElement('div');
				chooseDiv.style.padding="10px";
				if(helpList[i].chooseID==0)
					chooseDiv.innerHTML="<font style='14px bold'>暂时无人承接 请申请</font>";
				else if(userID==helpList[i].chooseID)//链接到主页
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].chooseID+"'/>"+helpList[i].chooseName+"</a></font>";
				else				//链接到其他人的个人页面
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='hisSpace.htm?"+helpList[i].chooseID+"'><img width=50 height=50 src='imgpick/uploads/"+helpList[i].chooseID+"'/>"+helpList[i].chooseName+"</a></font>";			
				reqDiv.appendChild(chooseDiv);

				var  cateDiv=document.createElement('div');
				cateDiv.style.padding="10px";
				cateDiv.innerHTML="<font style='14px bold'>类别：		"+helpList[i].cate+"</font>";				
				reqDiv.appendChild(cateDiv);

				var  descriptionDiv=document.createElement('div');
				descriptionDiv.style.padding="10px";
				descriptionDiv.innerHTML="<font style='14px bold'>简介：        "+helpList[i].description+"</font>";				
				reqDiv.appendChild(descriptionDiv);

				var  detailDiv=document.createElement('div');
				detailDiv.style.padding="10px";
				detailDiv.innerHTML="<font style='14px bold'>详情：       "+helpList[i].detail+"</font>";				
				reqDiv.appendChild(detailDiv);
				//状态
				var  statusDiv=document.createElement('div');
				statusDiv.style.padding="10px";
				statusDiv.innerHTML="<font style='14px bold'>状态：       "+helpList[i].statusstr+"</font>";				
				reqDiv.appendChild(statusDiv);
				//对发布人评分
				var  ScoreReqDiv=document.createElement('div');
				ScoreReqDiv.style.padding="10px";
				if(helpList[i].flagScoreReq!=0)	
					ScoreReqDiv.innerHTML="<font style='14px bold'>发布人得分：       "+helpList[i].ScoreReq+"</font>";				
				else
					ScoreReqDiv.innerHTML="<font style='14px bold'>承接人还没有对发布人打分</font>";				
				reqDiv.appendChild(ScoreReqDiv);
				//对承接人评分
				var  ScoreChooseDiv=document.createElement('div');
				ScoreChooseDiv.style.padding="10px";
				if(helpList[i].flagScoreChoose!=0)	
					ScoreChooseDiv.innerHTML="<font style='14px bold'>承接人得分：       "+helpList[i].ScoreChoose+"</font>";				
				else
					ScoreChooseDiv.innerHTML="<font style='14px bold'>发布人还没有对承接人打分</font>";				
				reqDiv.appendChild(ScoreChooseDiv);

				helpListDiv.appendChild(reqDiv);				
			}	
		}	
}

function addHelp()
{
	$("#helps").hide();
	$("#addhelp").show();
}
//发布一个任务
function reqHelp()
{
	var title=document.getElementById('title').value;
	var money=document.getElementById('money').value;
	var cate=document.getElementById('cate').value;
	var description=document.getElementById('description').value;
	var detail=document.getElementById('detail').value;
	var username=getCookie("username");
	var userID=getCookie("userID");
	//alert(username);
	//alert("debug");
	//TODO 上传附件和照片
	
	if(username==null || username=="" || userID==null || userID=="")
	{
		alert("请先登录");
	}
	else if(title==""||title==null)
	{
		alert("求助的时候 标题还是不要为空的好！");
	}
	else
	{
		var url="help/help.php?action=reqHelp";
		var para="&title="+title;
		para +="&money="+money;
		para +="&cate="+cate;
		para +="&description="+description;
		para +="&detail="+detail;
		para +="&username="+username;
		para +="&userID="+userID;
		var resp=SendPostRequest(url,para);

		alert(resp);
		
		if(resp=="存在同名标题 请修正标题")
			alert('存在同名标题 请修正标题');

		if(resp=="false")
			alert('发布Help需求失败');	
		
		if(resp=="true")
		{
			alert('发布Help需求成功 您的活跃度+3');
			$("#helps").show();
			$("#addhelp").hide();
			
			var ireqli = $("#ireqli");
			ireqli.addClass("selector_on");
			ireqli.removeClass("selector_off");
			var reqli = $("#reqli");
			reqli.addClass("selector_off");
			reqli.removeClass("selector_on");
			showiReqList();
			GetUserInfo();//因为发布需求的时候 用户活跃度+3 有所刷新
		}	
	}
}

function CheckEmpty(obj,warnID,warnInfo)
{
	var warnElement=document.getElementById(warnID);
	
	if(obj.value==null || obj.value=="")
	{		
		warnElement.innerHtml=warnInfo;
		return false;
	}
	else
	{
		warnElement.innerHtml="OK";
	   return true;
	}
}

</script>  
</head>
<body onload="GetUserInfo()">
<div id="showcookies"></div>  <!--显示当前用户cookie中的用户名-->

<div id="all">
    <div id="header">
        <div id="inner_header" class="central_fixed_width">
			<img src='imgpick/uploads/logo.jpg'/> 
		    <h1 class="logo">帮帮网</h1>
            <div id="user_status"><a href="login.htm">登陆</a>||<a href="register.html">注册</a></div>
            <ul id="nav_bar">
                <li><a href="activity/activity.html"><span class="nav_item">活动</span></a></li>
                <li><a href="index.html"><span class="nav_item">悬赏求助大厅</span></a></li>
                <li><a href="myspace.html"><span class="nav_item">个人主页</span></a></li>
                <li><a href="dianping.html"><span class="nav_item">点评</span></a></li>
                <li><a href="novel.html"><span class="nav_item">小说</span></a></li>
                <li class="clear"></li>
            </ul>
        </div>
    </div>
    
    <div id="content" class="central_fixed_width">

        <div class="content_parent">
			<div id="left_bar">
                    <ul>
                        <a href="friend/friend.htm" ><li class="selector_off">我关注的人</li></a>
                        <a href="friend/follower.htm" ><li class="selector_off">关注我的人</li></a>
                    </ul>
					<br>
					<hr>
					<br>
					<h2> 我关注的版面</h2>
					<br>
					<ul id="iFocusCateList">
					</ul>
			</div>

            <div class="main_column">
                <div id="selector">
                    <ul>
                        <li class="selector_on" onclick="showiFocusList()">我关注的分类</li>
                        <li class="selector_off" onclick="showfriendReqList()">我朋友的悬赏求助</li>
                        <li class="selector_off" onclick="showiApplyList()">我申请的</li>
                        <li class="selector_off" onclick="showiChooseList()">指定给我的</li>
                        <li id="ireqli" class="selector_off" onclick="showiReqList()">我发布的</li>
                        <li class="selector_off" onclick="showAllReqList()">随便看看</li>
                        <li id="reqli" class="selector_off" onclick="addHelp()">发布任务</li>
                    </ul>
                    <div class="clear"></div>
                </div>
                <div id="helps">
                    <div class="help">
                        <div class="content"><span class="activity_owner">老赵</span> 发布了任务<a href="#">做个页面</a></div>
                        <div class="activity_timestamp">30 分钟前</div>
                    </div>
                    <div class="help">
                        <div class="content"><span class="activity_owner">老赵</span> 发布了任务<a href="#">做个页面</a></div>
                        <div class="activity_timestamp">30 分钟前</div>
                    </div>
					
                    <div class="help">
                        <div class="content"><span class="activity_owner">老赵</span> 发布了任务<a href="#">做个页面</a></div>
                        <div class="activity_timestamp">30 分钟前</div>
                    </div>
                    <div class="help">
                        <div class="content"><span class="activity_owner">老赵</span> 发布了任务<a href="#">做个页面</a></div>
                        <div class="activity_timestamp">30 分钟前</div>
                    </div>
                </div>

				<div id="addhelp">
					<h3>悬赏</h3>
					<div>
						标题:<input id="title"  onblur="CheckEmpty(this,'warntitle','标题有效期不能为空！')"/><span id="warntitle" class="warning">&nbsp;*</span><br>
						目标赏金:<input id="money" type="text" size="24" />RMB<br>
						类别:<select id="cate"> <!--读数据库-->
							<option value=''></option>
							<option value=1 >生活</option>
							<option value=2 >软件</option>
							<option value=3 >电脑</option>
							<option value=4 >足球</option>
							</select><br>
							简介:<br><textarea id="description"  rows="3" cols="50"  onblur="CheckEmpty(this,'warndes','简介不能为空！')"  ></textarea>
							<span id="warndes" class="warning">&nbsp;*</span><br>
							具体内容:<br><textarea id="detail"  rows="15" cols="50" onblur="CheckEmpty(this,'warnDetail','具体内容不能为空！')"  ></textarea>
							<span id="warnDetail" class="warning">&nbsp;*</span><br>
							上传附件:<input type="file" id="upfile"/><br>
							<br>
							<input type="button" value="确定" onclick="reqHelp()"/>    
					</div>
				</div>

            </div>

            <div class="sidebar">
                <div id="user_info">
                    <div id="user_avatar">
                        <img src="1" />
                    </div>
                    <div id="user_data">
						<p>郑国栋</p>
                        <p>QQ：250082363</p>
                        <p>手机：15026597525</p>
                        <p>性别：男</p>
                        <p>状态：恋爱中</p>
						<p>出生年月日： 0年0月0日</p>
						<p>活跃度 8</p>
						<p>好评度 890</p>
						<p>差评度 0</p>
						<p>历史记录</p>
                    </div>
                </div>
            </div>
            <div class="clear"></div>
        </div>
        
        
    </div>
    
    <div id="footer">
        <div id="inner_footer" class="central_fixed_width">


            <div class="footer_links">
                &copy; 2011 帮帮网 All rights reserved.
            </div>
            <div class="clear"></div>
            
        </div>
    </div>
  </div>
</body>
</html>

